package v1

import (
	//"fmt"
	//"time"
	"github.com/gogf/gf/net/ghttp"
	"fmt"
	"log"
	"time"
	"com.cyt.yunpay/library/queue"

	"github.com/thoas/bokchoy"
)

// 测试对象
var Test = new(test)

type test struct{}

// 创建密钥配置
func (a *test) Test(r *ghttp.Request) {
	payload := map[string]string{
		"data": "hello world",
	}

	task, err := queue.Engine.Queue("tasks.message").Publish(queue.Ctx, payload,
		bokchoy.WithTimeout(1*time.Second), bokchoy.WithCountdown(10*time.Second))
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(task, "has been published")
	//response.JsonExit(r, 0, "创建成功")
}